<script setup lang="ts">
import { Search, Close, Plus, Edit, Delete } from "@element-plus/icons-vue"
import useUserTable from '@/composables/zb/useZbTable';
import useUser from "@/composables/zb/useZb";
import AddUser from './AddZb.vue'
 
const { listParam, getList, resetBtn, searchBtn, tableList,  tableHeight } = useUserTable(); 
const { addBtn, deleteBtn, editBtn, addRef } = useUser(getList)  
</script>

<template>
  <el-main>
    <el-form :model="listParam" label-width="80px" :inline="true" size="default">
      <el-form-item>
        <el-input v-model="listParam.zhouBaoMingCheng" placeholder="请输入周报名称"></el-input>
      </el-form-item>
                                                                       
      <el-form-item>
        <el-button :icon="Search" @click="searchBtn">搜索</el-button>
        <el-button :icon="Close" type="danger" plain @click="resetBtn">重置</el-button>
        <el-button type="primary" :icon="Plus" @click="addBtn">新增</el-button>
      </el-form-item>
    </el-form>
    <!-- 用户列表 -->
    <el-table :height="tableHeight" :data="tableList" border stripe>
      <el-table-column label="周报时间" prop="zhouBaoShiJian"></el-table-column>
      <el-table-column label="周报名称" prop="zhouBaoMingCheng"></el-table-column>
      <el-table-column label="周报内容" prop="zhouBaoNeiRong"></el-table-column>
      <el-table-column label="周报备注" prop="beiZhu"></el-table-column>
      <el-table-column label="操作" width="230">
        <template #default="scope">
          <el-button type="primary" :icon="Edit" size="default" @click="editBtn(scope.row)">编辑</el-button>
          <el-button type="danger" :icon="Delete" size="default" @click="deleteBtn(scope.row)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
  </el-main>
  <AddUser ref="addRef" @onFresh="getList"></AddUser>
</template>
<style scoped></style>